<?php
class BlockController extends AppController{
    public function head()
    {
        $this->autoRender = false;
    }
    
    public function adv(){
        $this->autoRender = false;
        $lang_code = $this->Session->read('lang_code');
        $this->loadModel('Category'); $this->Category->lang_code = $lang_code;
        $this->loadModel('Media'); $this->Media->lang_code = $lang_code;
        $category_id = $this->Category->get_category_id_by_code('image_adv');
        $data['image_adv'] = $this->Media->get_media_by_category_id($category_id);
        
        return $data;
    }
    
    public function top_nav()
    {
        $this->autoRender = false;
        $lang_code = $this->Session->read('lang_code');
        $this->loadModel('Menu'); $this->Menu->lang_code = $lang_code;
        $list_menu = $this->Menu->get_menu_by_code('top_menu');
        return $list_menu;
    }
    /*
    public function sidebar()
    {
        $this->autoRender = false;
        $lang_code = $this->Session->read('lang_code');
        $this->loadModel('Menu'); $this->Menu->lang_code = $lang_code;
        $this->loadModel('Category'); $this->Category->lang_code = $lang_code;
        
        //$data['main_menu'] = $this->Menu->get_menu_by_code('main_menu');
        
        $data['menu_products'] = $this->Category->get_category_by_code('san_pham_do_choi');
        
        $data['menu_hsth'] = $this->Category->get_category_by_code('hoa_si_ti_hon');
        
        //$this->loadModel('Brand'); $this->Brand->lang_code = $lang_code;
        //$data['brands'] = $this->Brand->get_brand();
        
        return $data;
    }
    */
    public function footer()
    {
        $lang_code = $this->Session->read('lang_code');
        $this->loadModel('Menu'); $this->Menu->lang_code = $lang_code;
        $data['footer_menu'] = $this->Menu->get_menu_by_code2('footer_menu');
        $data['ve_chung_toi'] = $this->Menu->get_menu_by_code2('ve_chung_toi');
        $data['tai_khoan_cua_ban'] = $this->Menu->get_menu_by_code2('tai_khoan_cua_ban');
        $data['tro_giup'] = $this->Menu->get_menu_by_code2('tro_giup');
        return $data;
    }
    
    /*
    public function menu_products()
    {
        $this->autoRender = false;
        $lang_code = $this->Session->read('lang_code');
        $this->loadModel('Category'); $this->Category->lang_code = $lang_code;
        $data['menu_products'] = $this->Category->get_category_by_code('san_pham_do_choi');
        return $data;
    }
    */
    
}